package com.ruoyi.project.transport.inner.controller;

import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.transport.inner.domain.Jldybd;
import com.ruoyi.project.transport.inner.service.IJldybdService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 调运指令Controller
 * 
 * @author frank
 * @date 2024-08-16
 */
@RestController
@RequestMapping("/transport/inner/jldybd")
public class JldybdController extends BaseController
{
    @Autowired
    private IJldybdService jldybdService;

    /**
     * 查询调运指令列表
     */
    @PreAuthorize("@ss.hasPermi('transport/inner:jldybd:list')")
    @GetMapping("/list")
    public TableDataInfo list(Jldybd jldybd)
    {
        startPage();
        List<Jldybd> list = jldybdService.selectJldybdList(jldybd);
        return getDataTable(list);
    }

    /**
     * 导出调运指令列表
     */
    @PreAuthorize("@ss.hasPermi('transport/inner:jldybd:export')")
    @Log(title = "调运指令", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Jldybd jldybd)
    {
        List<Jldybd> list = jldybdService.selectJldybdList(jldybd);
        ExcelUtil<Jldybd> util = new ExcelUtil<Jldybd>(Jldybd.class);
        util.exportExcel(response, list, "调运指令数据");
    }

    /**
     * 获取调运指令详细信息
     */
    @PreAuthorize("@ss.hasPermi('transport/inner:jldybd:query')")
    @GetMapping(value = "/{jlDybdoid}")
    public AjaxResult getInfo(@PathVariable("jlDybdoid") String jlDybdoid)
    {
        return success(jldybdService.selectJldybdByJlDybdoid(jlDybdoid));
    }

    /**
     * 新增调运指令
     */
    @PreAuthorize("@ss.hasPermi('transport/inner:jldybd:add')")
    @Log(title = "调运指令", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Jldybd jldybd)
    {
        return toAjax(jldybdService.insertJldybd(jldybd));
    }

    /**
     * 修改调运指令
     */
    @PreAuthorize("@ss.hasPermi('transport/inner:jldybd:edit')")
    @Log(title = "调运指令", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Jldybd jldybd)
    {
        return toAjax(jldybdService.updateJldybd(jldybd));
    }

    /**
     * 删除调运指令
     */
    @PreAuthorize("@ss.hasPermi('transport/inner:jldybd:remove')")
    @Log(title = "调运指令", businessType = BusinessType.DELETE)
	@DeleteMapping("/{jlDybdoids}")
    public AjaxResult remove(@PathVariable String[] jlDybdoids)
    {
        return toAjax(jldybdService.deleteJldybdByJlDybdoids(jlDybdoids));
    }
}
